<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/cardlist.css"/>
    <style>
        .glyphicon-plus:before {
            margin-left: 3px;
        }

        .btn-link:hover {
            text-decoration: none;
        }
    </style>
</head>
<body id="body">
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content" id="page-memberCardSettings">
        <!--路径导航-->
        <ol class="breadcrumb mgl15 mgr15">
            <li>当前位置是&nbsp;:</li>
            <li><a href="javascript:void(0);">礼品卡管理</a></li>

            <li class="active" style="color: #02b87f;">礼品卡列表</li>
        </ol>
        <!--创建会员卡主要内容-->
        <div class="card-content mgl15 mgr15 clearfix">
            <form class="form-horizontal ">
                <div class="panel panel-default">
                    <div class="panel-heading">礼品卡列表</div>
                    <div class="panel-body">
                        <div class=" member_card-list responsive row">
                            {volist name="list" id="vo"}
                            <div class="pull-left pd15">
                                <a href="{:url('cardgifts/editcardgift',['card_id'=>$vo['card_id']])}">
                                    {notempty name="vo.pic_url"}
                                    <div class="card" style="background-image: url({$vo.pic_url});background-position:center center;background-repeat: repeat;background-size: cover;">
                                        {else/}
                                        <div class="card" style="background-image: url(__STATIC_URL__/static/mobile/images/card_b.png);background-color: {$vo['color']};background-position: left top;background-repeat: repeat;background-size: cover;">
                                            {/notempty}
                                            <div class="cardL-top">
                                                <div class="cardL-logo-wrap pull-left">
                                                    <div style="background-size: cover;background-image:url({$vo.logo_url});background-position:left top;"  class="cardL-logo logopic"></div>
                                                </div>
                                                <div class="pull-left">
                                                    <div class="cardL-name brand_name">{$vo.brand_name}</div>
                                                    <div class="cardL-name brand_title">{$vo.title}</div>
                                                </div>
                                            </div>
                                            <div class="cardbottom pd15 clearfix" style="">
                                                <div class="pull-left"></div>
                                            </div>
                                        </div>
                                </a>
                                <div class="pd15 clearfix" style="text-align:center;">
                                    {if condition="checkPath('cardgifts/getgiftlists')"}

                                    <a class="btn-link" style="display: inline-block;" href="{:url('cardgifts/getgiftlists',['card_id'=>$vo['card_id']])}">领卡列表&nbsp;&nbsp;</a>
                                    {/if}
                                    {if condition="checkPath('cardgifts/delcardgift')"}
                                    <a class="btn-link" style="display: inline-block;" href="javascript:;" onclick="show('{$vo.card_id}')">|&nbsp;&nbsp;删除&nbsp;&nbsp;</a>
                                    {/if}
                                </div>
                            </div>
                            {/volist}


                            <div class="pull-left  pd15">
                                <div class="member_card-item">
                                    <a href="{:url('cardgifts/creatcardgift')}">
                                        <div class="member_card-body">
                                            <i class="glyphicon glyphicon-plus"></i>
                                            <div class="r-desc">创建礼品卡</div>
                                        </div>
                                    </a>
                                </div>
                            </div>


                        </div>
                        {$list->render()}
                    </div>
                </div>
            </form>
        </div>
        {include file='public/footer'/}

    </div>
</section>

</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">删除礼品卡</h4>
            </div>
            <div class="modal-body">是否删除礼品卡，删除后将同时删除领卡记录，核销记录。</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" data-id="" onclick="del();" id="cid">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</body>
<script>
    function show(id){
        $("#cid").attr("data-id",id);
        $('#myModal').modal('show')

    }
</script>
<script>
    function del(){
        var id=$("#cid").attr("data-id");
        $('#myModal').modal('hide');
        // console.log(id)
        // console.log(232);
        $.ajax({
            url:"{:url('cardgifts/delcardgift')}",
            data:{card_id:id},
            type:"post",
            success:function(data){
             console.log(52132,data);
                if(data.code==0){
                    layer.msg(data.message);
                    setTimeout(function(){
                        window.location.reload()
                    },2000)
                }else{
                    layer.msg(data.message);
                }

            }
        })
    }
</script>
</html>
